package com.timguan.render.api.entity;

import java.util.List;

/**
 * Created by guankaiqiang on 2014/12/16.
 */
public class Page<T> {
    public PageInfo pageInfo;
    public List<T>  data;
    public Page(List<T> data, int pageIndex, int pageSize, int totalCount) {
        this.data = data;
        PageInfo pageInfo = new PageInfo();
        pageInfo.hasMore = pageIndex * pageSize < totalCount;
        pageInfo.pageIndex = pageIndex;
        pageInfo.pageSize = pageSize;
        pageInfo.totalCount = totalCount;
        pageInfo.totalPageCount = totalCount % pageSize != 0 ? totalCount / pageSize + 1 : totalCount / pageSize;
        this.pageInfo = pageInfo;
    }
    public PageInfo getPageInfo() {
        return pageInfo;
    }
    public void setPageInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }
    public List<T> getData() {
        return data;
    }
    public void setData(List<T> data) {
        this.data = data;
    }
}
